/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PuzzleDetails.java
 *
 * Created on Aug 29, 2011, 9:35:52 AM
 */

package cw.ui;

import cw.biz.PuzzleBiz;
import cw.entity.Puzzle;

/**
 *
 * @author VinhTC
 */
public class PuzzleDetails extends javax.swing.JPanel {
    String puzzleName = "";
    AdminMainPanel amp = new AdminMainPanel();
    PuzzleBiz biz = new PuzzleBiz();
    /** Creates new form PuzzleDetails */
    public PuzzleDetails() {
        initComponents();
        InitialGui();
    }

    /**
     * InitialGui
     */
    public void InitialGui() {
        puzzleName = amp.getPuzzleName();
        Puzzle puzzle = new Puzzle();
        puzzle = biz.findPuzzleByName(puzzleName);
        jlblPuzzleName.setText(puzzle.getPuzzleName());
        jlblRowSize.setText(String.valueOf(puzzle.getPuzzleSize().getRowSize()) +" cell");
        jlblColSize.setText(String.valueOf(puzzle.getPuzzleSize().getColSize())+" cell");
        jlblLevel.setText(puzzle.getLevel().getLevelName());
        jlblTime.setText(String.valueOf(puzzle.getLevel().getCountDown()) +" second");
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jpnPuzzleDetails = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        jlblRowSize = new javax.swing.JLabel();
        jlblColSize = new javax.swing.JLabel();
        jlblPuzzleName = new javax.swing.JLabel();
        jlblLevel = new javax.swing.JLabel();
        jlblTime = new javax.swing.JLabel();
        jlblBackground = new javax.swing.JLabel();

        jpnPuzzleDetails.setName("jpnPuzzleDetails"); // NOI18N
        jpnPuzzleDetails.setOpaque(false);

        jLabel1.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
        jLabel1.setForeground(new java.awt.Color(153, 0, 0));
        jLabel1.setText("Puzzle name: ");
        jLabel1.setName("jLabel1"); // NOI18N

        jLabel2.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
        jLabel2.setForeground(new java.awt.Color(153, 0, 0));
        jLabel2.setText("Row size: ");
        jLabel2.setName("jLabel2"); // NOI18N

        jLabel3.setFont(new java.awt.Font("Tahoma", 2, 12));
        jLabel3.setForeground(new java.awt.Color(153, 0, 0));
        jLabel3.setText("Column size: ");
        jLabel3.setName("jLabel3"); // NOI18N

        jLabel4.setFont(new java.awt.Font("Tahoma", 2, 12)); // NOI18N
        jLabel4.setForeground(new java.awt.Color(153, 0, 0));
        jLabel4.setText("Level: ");
        jLabel4.setName("jLabel4"); // NOI18N

        jLabel5.setFont(new java.awt.Font("Tahoma", 2, 12));
        jLabel5.setForeground(new java.awt.Color(153, 0, 0));
        jLabel5.setText("Time: ");
        jLabel5.setName("jLabel5"); // NOI18N

        jlblRowSize.setForeground(new java.awt.Color(0, 51, 255));
        jlblRowSize.setText("2");
        jlblRowSize.setName("jlblRowSize"); // NOI18N

        jlblColSize.setForeground(new java.awt.Color(0, 51, 255));
        jlblColSize.setText("3");
        jlblColSize.setName("jlblColSize"); // NOI18N

        jlblPuzzleName.setFont(new java.awt.Font("Tahoma", 1, 11)); // NOI18N
        jlblPuzzleName.setForeground(new java.awt.Color(255, 204, 0));
        jlblPuzzleName.setText("1");
        jlblPuzzleName.setName("jlblPuzzleName"); // NOI18N

        jlblLevel.setForeground(new java.awt.Color(0, 51, 255));
        jlblLevel.setText("4");
        jlblLevel.setName("jlblLevel"); // NOI18N

        jlblTime.setForeground(new java.awt.Color(0, 51, 255));
        jlblTime.setText("5");
        jlblTime.setName("jlblTime"); // NOI18N

        javax.swing.GroupLayout jpnPuzzleDetailsLayout = new javax.swing.GroupLayout(jpnPuzzleDetails);
        jpnPuzzleDetails.setLayout(jpnPuzzleDetailsLayout);
        jpnPuzzleDetailsLayout.setHorizontalGroup(
            jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel1)
                    .addComponent(jLabel2)
                    .addComponent(jLabel3)
                    .addComponent(jLabel5)
                    .addComponent(jLabel4))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                        .addComponent(jlblLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 131, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addContainerGap())
                    .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                        .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                            .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                .addComponent(jlblRowSize, javax.swing.GroupLayout.PREFERRED_SIZE, 235, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(jlblPuzzleName, javax.swing.GroupLayout.DEFAULT_SIZE, 235, Short.MAX_VALUE))
                            .addGap(46, 46, 46))
                        .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                            .addComponent(jlblTime, javax.swing.GroupLayout.PREFERRED_SIZE, 183, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap())
                        .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                            .addComponent(jlblColSize, javax.swing.GroupLayout.PREFERRED_SIZE, 96, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addContainerGap()))))
        );
        jpnPuzzleDetailsLayout.setVerticalGroup(
            jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jpnPuzzleDetailsLayout.createSequentialGroup()
                .addGap(21, 21, 21)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel1)
                    .addComponent(jlblPuzzleName, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(12, 12, 12)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel2)
                    .addComponent(jlblRowSize, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(24, 24, 24)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jlblColSize, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel4)
                    .addComponent(jlblLevel, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(jpnPuzzleDetailsLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jLabel5)
                    .addComponent(jlblTime, javax.swing.GroupLayout.PREFERRED_SIZE, 21, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(17, Short.MAX_VALUE))
        );

        jlblBackground.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Puzzle Background.jpg"))); // NOI18N
        jlblBackground.setAlignmentY(0.0F);
        jlblBackground.setName("jlblBackground"); // NOI18N
        jlblBackground.setOpaque(true);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpnPuzzleDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jlblBackground, javax.swing.GroupLayout.DEFAULT_SIZE, 387, Short.MAX_VALUE)
                    .addContainerGap()))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jpnPuzzleDetails, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addContainerGap())
            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                    .addContainerGap()
                    .addComponent(jlblBackground, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE)
                    .addContainerGap()))
        );

        jlblBackground.getAccessibleContext().setAccessibleParent(this);
    }// </editor-fold>//GEN-END:initComponents


    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jlblBackground;
    private javax.swing.JLabel jlblColSize;
    private javax.swing.JLabel jlblLevel;
    private javax.swing.JLabel jlblPuzzleName;
    private javax.swing.JLabel jlblRowSize;
    private javax.swing.JLabel jlblTime;
    private javax.swing.JPanel jpnPuzzleDetails;
    // End of variables declaration//GEN-END:variables

}
